package com.lx.idea.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lx.idea.model.ApplicationSecret;
import com.lx.idea.model.CurrentNode;
import com.lx.idea.model.Node;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

@Mapper
public interface NodeMapper extends BaseMapper<Node>{

    //查看下级节点信息
    @Select("select * from node_tb n left join prefix_netx_tb p on n.prefix_id=p.id where p.prefix_next=#{prefix} limit 1")
    Node selectJoin(@Param("prefix") String prefix);

    //查看密钥是否存在
    @Select("select * from application_key_tb where del_flag=0 and app_key=#{key} and app_secret=#{secret} limit 1")
//    @Select("select * from application_key_tb where del_flag=0 and app_key=#{arg0} and app_secret=#{arg1} limit 1")
    ApplicationSecret getAppInfo(@Param("key") String key, @Param("secret") String secret);

    //当前节点信息
    @Select("select *  from prefix_self_tb limit 1")
    CurrentNode getCurrPrefix();


}
